package com.example.hospital_208.service.impl;

import com.example.hospital_208.dao.RoomDao;
import com.example.hospital_208.po.Room;
import com.example.hospital_208.service.RoomService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class RoomServiceImpl implements RoomService {

    @Autowired
    private RoomDao roomDao;

    @Override
    public List<Room> listRooms() {
        return roomDao.selectAll();
    }

    @Override
    public Room getRoomById(Integer roomId) {
        return roomDao.selectById(roomId);
    }

    @Override
    public int addRoom(Room room) {
        return roomDao.insert(room);
    }

    @Override
    public int updateRoom(Room room) {
        return roomDao.update(room);
    }

    @Override
    public int deleteRoom(Integer roomId) {
        return roomDao.deleteById(roomId);
    }
}